package com.devilvan.service;

import com.devilvan.entity.Dept;
import com.devilvan.fallback.DeptClientServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

// 开启Feign负载均衡，value为已经注册的服务名
@FeignClient(value = "SPRINGCLOUD-PROVIDE-DEPT",fallbackFactory = DeptClientServiceFallbackFactory.class)
//@FeignClient(value = "springcloud-provide-dept-hystrix")
public interface DeptClientService {

    @GetMapping(value = "addDept",produces = "application/json; charset=UTF-8")
    boolean addDept(Dept dept);

    @GetMapping(value = "queryDeptById/{dept_id}",produces = "application/json; charset=UTF-8")
    Dept queryDeptById(@PathVariable("dept_id") Long dept_id);

    @GetMapping(value = "queryAllDepts",produces = "application/json; charset=UTF-8")
    List<Dept> queryAllDepts();
}
